home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -in_the_mag- / reader_requests / scilab / tests / fort.tst < prev    next >
Text File  |  1999-09-16  |  2KB  |  85 lines

  1. a =[1,2,3];b =[1,2,3;4,5,6];c =[10,11;12,13];
  2. //
  3. //short call: fortran instructions to be inserted in interf.f
  4. //      if(nom.eq.'bidon1') then
  5. //      ia =size(1,nla ,nca )
  6. //      ib =size(2,nlb ,nlc )
  7. //      ic =size(3,nlc ,ncc )
  8. //      id =ic
  9. //      nld=nlc
  10. //      ncd=ncc
  11. //      call alloc(1,ia ,nla ,nca ,'i')
  12. //      call alloc(2,ib ,nlb ,ncb ,'r')
  13. //      call alloc(3,ic ,nlc ,ncc ,'d')
  14. //      call alloc(4,id ,nld ,ncd ,'d')
  15. //      call alloc(5,id ,nld ,ncd ,'d')
  16. //      call bidon(stk(ll(1)),ia,stk(ll(2)),ib,stk(ll(3)),ic,
  17. //     *           stk(ll(4)),stk(ll(5)),ic)
  18. //      call back(1)
  19. //      call back(2)
  20. //      call back(3)
  21. //      call back(4)
  22. //      return
  23. //      endif
  24. //
  25. //fort call in scilab
  26. [as,bs,cs,ds]=fort('bidon1',a ,b ,c );
  27. as-2*a
  28. bs-2*b
  29. cs-2*c
  30. ds-(2*c+[1,3;2,4])
  31. //
  32. //
  33. //Test no 2 : insert the following in interf.f:
  34. //      if(nom.eq.'bidon2') then
  35. //      call bidon(x1,x2,x3,x4,x5,x6,x7,x8,x9)
  36. //      return
  37. //      endif
  38. // calling from scilab:
  39. //a interf.
  40. [ma,na]=size(a);ia=ma*na;
  41. [mb,nb]=size(b);ib=mb*nb;
  42. [mc,nc]=size(c);ic=mc*nc;
  43. md=mc;nd=nc;
  44. [as,bs,cs,ds]=fort('bidon2',a,1,'i',ia,2,'i',b,3,'r',ib,4,'i',...
  45.                             c,5,'d',ic,6,'i',...
  46.                    'out',[ma,na],1,'i',[mb,nb],3,'r',[mc,nc],5,'d',...
  47.                           [md,nd],7,'d',[mc,nc],8,'d',[1,1],9,'i');
  48. as-2*a
  49. bs-2*b
  50. cs-2*c
  51. ds-(2*c+[1,3;2,4])
  52. //other valid form
  53. [as,bs,cs,ds]=fort('bidon2',a,1,'i',ia,2,'i',b,3,'r',ib,4,'i',...
  54.                             c,5,'d',ic,6,'i',...
  55.                    'out',1,3,5,...
  56.                           [md,nd],7,'d',[mc,nc],8,'d',[1,1],9,'i');
  57. as-2*a
  58. bs-2*b
  59. cs-2*c
  60. ds-(2*c+[1,3;2,4])
  61. //Test no 3 : insert in interf.f
  62. //
  63. //      if(nom.eq.'bidon3') then
  64. //      ia=size(1,nla,nca)
  65. //      ib=size(2,nlb,ncb)
  66. //      ic=size(3,nlc,ncc)
  67. //      call alloc(4,ic,nlc,ncc,'d')
  68. //      call alloc(5,ic,nlc,ncc,'d')
  69. //      call bidon(stk(ll(1)),ia,stk(ll(2)),ib,stk(ll(3)),ic,
  70. //     1           stk(ll(4)),stk(ll(5)),ic)
  71. //      call back(1)
  72. //      call back(2)
  73. //      call back(3)
  74. //      call back(4)
  75. //      return
  76. //      endif
  77. //
  78. // Call from scilab:
  79. [as,bs,cs,ds]=fort('bidon3',a,1,'i',b,2,'r',c,3,'d',...
  80.                    'out',1,2,3,4);
  81. as-2*a
  82. bs-2*b
  83. cs-2*c
  84. ds-(2*c+[1,3;2,4])
  85.